import java.util.ArrayList;
import java.util.InputMismatchException;
import java.util.Scanner;

public class NGuessNumber {
    // 重要改动：去掉 static！
    public Scanner scanner = new Scanner(System.in);
    public ArrayList<Integer> answers = new ArrayList<>();
    public ArrayList<Integer> guesses = new ArrayList<>();

    // ...（main方法、generateAnswer、receiveGuesses 保持原样不变）

    // 修正后的 getA()
    public int getA() {
        int a = 0;
        for (int i = 0; i < 4; i++) {
            if (answers.get(i).equals(guesses.get(i))) { // 正确比较逻辑
                a++;
            }
        }
        return a;
    }

    // 保持 getB() 不变
}